<extend name="Base/common"/>
<block name="body">
<style type="text/css">
    .course-tr{ height: 140px; }
    .course-span{ padding-left: 50px; }
    .div-class{ margin-left: 300px; }
    .div-span{ margin-left: 20px; }
    #sapn-id{ color: red; }
    .class-span{ cursor:pointer; }
</style>
    <div>
    <a href="#" onClick="javascript :history.go(-1);">返回</a>
    <table>
            <tr class="course-tr">
                <td class="course-td">
                    <img width="100" height="100" src="__ROOT__{$data.logo|getimg=###}">地区：{$data.area_id|getArea=###}&nbsp;&nbsp;&nbsp;课程：{$data.title}&nbsp;&nbsp;价格:{$data.salary}<br />
                    {$data.nickname}<br /><if condition="$data['sex'] eq 1 "><img src="__IMG__/sex/1nan.png"><else /><img src="__IMG__/sex/2nv.png"></if>{$data.age}<br /><span>剩余课时：　　{$num}</span><br /><if condition="$data['confirm'] eq 2 ">以认证<else />未认证</if>
                </td>
            </tr>
            <tr>
                <td>
                    <eq name="num" value="0">
                        <button class="assess">评价</button>
                        <input type="hidden" value="{$data.id}">
                    </eq>
                </td>
            </tr>
    </table>
    </div>
            <div class="div-class">我的课程:</div>
            <div class="div-class">
               <volist name='time' id='vol'>
                        <eq name="vol.at_class" value="1">
                                <span class="div-span" id="sapn-id">{$vol.class_date|date='Y-m-d H:i:s',###}<br/>----第{$vol.num}次</span>
                            <else/>
                                <neq name="vol.class_date" value="0">
                                <input class="div-span class-span-disan" type="checkbox" name="check" value="{$vol.uid}">{$vol.class_date|date='Y-m-d H:i:s',###}----第{$vol.num}
                                </neq>
                        </eq>
                        <eq  name="vol.class_date" value="0">
                        <input class="div-span class-span-disan" type="checkbox" name="check" value="{$vol.uid}">暂无----{$vol.num}
                        </eq>
                </volist>
                <button class="tuiding">退 订</button>
                <input type="hidden" value="{$data.id}">
            </div>
    </div>
    <script type="text/javascript">
    $('.tuiding').on('click',function(){
         var chk_value =[];
            $('input[name="check"]:checked').each(function(){
            chk_value.push($(this).val());
             });
        var cid = $(this).next('input:hidden').val();
        $.ajax({
            url: "{:U('CourseRecord/cancel')}",
            type: 'POST',
            dataType: 'json',
            data: {id: chk_value,cid:cid},
            success:function(data){
            layer.msg('退订成功！', {
                  time: 20000, //20s后自动关闭
                });
            }
        })
        location.reload();
    });

    $('.assess').on('click',function(){
        var id = $(this).next('input:hidden').val();
        window.location.href='__MODULE__/CourseEva/assess/id/'+id;
    });
    </script>
</block>